﻿<UserControl x:Class="EzDesk.DesktopClient.MessageModule.FeedItemView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" 
             d:DesignHeight="600" d:DesignWidth="600">
    <UserControl.Resources>
        <Style  TargetType="{x:Type  Image}" x:Key="FeedReadStatusStyle">
            <Setter Property="Source" Value="{StaticResource FeedNonRead}"></Setter>
            <Style.Triggers>
                <DataTrigger Binding="{Binding IsRead, IsAsync=False, Mode=OneWay}" Value="True">
                    <Setter Property="Source" Value="{StaticResource FeedIsRead}">
                    </Setter>
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </UserControl.Resources>
    <Border Margin="2"  BorderBrush="{StaticResource BorderGray}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"></RowDefinition>
                <RowDefinition Height="auto"></RowDefinition>
                <RowDefinition Height="auto"></RowDefinition>
                <RowDefinition Height="auto"></RowDefinition>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition MinWidth="200" Width="*"></ColumnDefinition>
                <ColumnDefinition Width="auto"></ColumnDefinition>
            </Grid.ColumnDefinitions>


            <StackPanel Grid.Row="0" Grid.RowSpan="2" Grid.Column="0"  HorizontalAlignment="Stretch">
                <ContentControl Hyperlink.RequestNavigate="ContentControl_RequestNavigate"  Content="{Binding ContentTitle,Converter={StaticResource XamlConverter}}"  HorizontalAlignment="Stretch"></ContentControl>
                <ContentControl Hyperlink.RequestNavigate="ContentControl_RequestNavigate"  Content="{Binding ContentBody,Converter={StaticResource XamlConverter}}"  HorizontalAlignment="Stretch"></ContentControl>
            </StackPanel>
            <Image Grid.RowSpan="2" Grid.Column="1"  Style="{StaticResource FeedReadStatusStyle}" HorizontalAlignment="Right" VerticalAlignment="Top" Width="15"></Image>
            <StackPanel  Grid.Row="2" Grid.ColumnSpan="2" HorizontalAlignment="Right" Orientation="Horizontal">
                <Button  Content="{StaticResource Mark}"></Button>
                <Button x:Name="SetToReadBtn" Content="{StaticResource SetAsRead}" Click="SetToReadBtn_Click">
                    <Button.Style>
                        <Style TargetType="{x:Type Button}"  BasedOn="{StaticResource {x:Type Button}}">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding IsRead,Mode=OneWay}" Value="True">
                                    <Setter Property="Visibility" Value="Collapsed">
                                    </Setter>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Button.Style>
                </Button>
                <Button  Content="{StaticResource BlockUpdate}"></Button>

                <TextBlock  Text="{Binding LastUpdate, Converter={StaticResource DatetimeConverter}}"  VerticalAlignment="Center" Foreground="{StaticResource FontBlue}">
                </TextBlock>
            </StackPanel>

            <Path Stretch="Fill" Grid.Row="3" Grid.ColumnSpan="2"   VerticalAlignment="Center" Height="3" StrokeThickness="1" Data="M1,1L0,1">
                <Path.Stroke>
                    <LinearGradientBrush EndPoint="1,1" StartPoint="0,1">
                        <GradientStop Color="#00000000" Offset="1"/>
                        <GradientStop Color="{StaticResource BackBlueColor}" Offset="0.8"/>
                        <GradientStop Color="{StaticResource BackBlueColor}" Offset="0.2"/>
                        <GradientStop Color="#00000000" Offset="0"/>
                    </LinearGradientBrush>
                </Path.Stroke>
            </Path>
        </Grid>
    </Border>
</UserControl>
